home *** CD-ROM | disk | FTP | other *** search
/ Internet Surfer 2.0 / Internet Surfer 2.0 (Wayzata Technology) (1996).iso / pc / text / mac / faqs.113 < prev    next >
Encoding:
Text File  |  1996-02-12  |  27.8 KB  |  670 lines

  1. Frequently Asked Questions (FAQS);faqs.113
  2.  
  3.  
  4.  
  5. 13. Process accounting is broken
  6.     In 4.0.3, process accounting doesn't work.  From examining the accounting
  7. scripts, it appears that /usr/lib/acct/accton is supposed to set a return code
  8. depending on whether accounting was switched on already or not.  However, it
  9. always returns the same result - accounting switched off.  This means that the
  10. /usr/lib/acct/ckpacct script, which is run every hour to keep the proccess
  11. accounting log in check, instead turns off accounting the first time it is run
  12. after booting.  The same happens with the nightly /usr/lib/acct/monacct
  13. program.
  14.    I don't yet know whether this bug is present in 4.0.4.  It is definitely
  15. un-fixed in Dell 2.1 and Consensys 1.3.  In Dell 2.2 the return bug is fixed,
  16. but accounting isn't automatically enabled at boot time.
  17.  
  18. 14. tar(1) foos up in the presence of symbolic links
  19.     Tar can get the names of symbolic links wrong when creating an archive.
  20. This bug can be demonstrated by doing the following:
  21.  
  22.    mkdir t
  23.    cd t
  24.    touch a 1234567890
  25.    ln -s 1234567890 b
  26.    ln -s a c
  27.    tar vcf ../t.tar .
  28.  
  29.    The output generated by tar is:
  30.  
  31.    a ./ 0 tape blocks
  32.    a ./a 0 tape blocks
  33.    a ./1234567890 0 tape blocks
  34.    a ./b symbolic link to 1234567890
  35.    a ./c symbolic link to a234567890
  36.  
  37. (Note the above commands should be done in the order shown and in a new
  38. directory)  This bug is nasty.  Recommended solution: use GNU tar.
  39.    This is reported from Esix 4.0.3 and Consensys 1.3, but probably exists on
  40. other SVr4s as well.
  41.  
  42. 15. Symbolic links can interfere with shellscript execution
  43.    There is a problem running #! scripts when symbolic links are involved.
  44. Typing in the following from a command shell demonstrates the problem:
  45.  
  46.    mkdir a b
  47.    ln -s a c
  48.    cd a
  49.    cat > script <<!
  50.    #!/bin/sh
  51.    echo Hello
  52.    !
  53.    chmod 755 script
  54.    cd ../b
  55.    ln -s ../c/script .
  56.    ./script
  57.  
  58. The message generated from the last line is:
  59.  
  60.      a/script: a/script: cannot open
  61.  
  62.    This is reported from Esix 4.0.3, Consensys 1.3, and Dell 2.2, but
  63. probably exists on other SVr4s as well.
  64.  
  65. 16. Piping a csh builtin causes the shell to hang.
  66.    While running csh, this can be demonstrated by some of the following:
  67.  
  68.    echo Hello | cat
  69.    history | more
  70.  
  71. (A solution to this one is use tcsh-6.02.)
  72.    This is reported from Esix 4.0.3 and Consensys 1.3, but probably exists on
  73. other SVr4s as well.  It is reported fixed in Dell 2.2.
  74.  
  75. 17. Quick port setup option in sysadm is broken
  76.    In 4.0.3 sysadm, the quick port setup option, which is used to add and
  77. delete terminal ports, is seriously broken.  The script modifies /etc/conf/*
  78. files, and has incorrect minor numbers, sets the 5th field of sdevice.d if Y
  79. when it should be N, and is missing columns for node.d.  See
  80. /usr/sadm/sysadm/bin/q-add.
  81.  
  82. 18. COFF binaries linked with curses(3) and shared libc hang
  83.    ...eating the CPU.  Cause unknown.
  84.  
  85. 19. shl hangs, sxt devices bad
  86.    shl(1) does not work.  Try creating a layer and doing an 'ls'.  Your session
  87. hangs.  Bruce Momjian <root%candle.uucp@bts.com>, who reported this bug, says
  88. he believes it is the sxt devices which are broken.  It definitely exists in
  89. Consensys 1.3.
  90.  
  91. 20. num-lock prevents mouse from working properly
  92.    When using the Motif window manager, if your num lock is on, your mouse
  93. clicks are not recognized by the window manager.  The mouse still works in
  94. xterm(1).  This is allegedly fixed in Destiny (4.2).
  95.  
  96. 21. adjtime() doesn't work
  97.   Hugh Stearns <hoyt@isus.tnet.com> reports that in 4.0.3.6 adjtime() doesn't.
  98. Calling `date -a' works to adjust the time slowly.
  99.  
  100. 22. ttymon drops DTR
  101.   Hugh Stearns <hoyt@isus.tnet.com> reports that in 4.0.3.6 the ttymon(1)
  102. utility for HDB uucp drops DTR every few weeks.  The workaround is to disable
  103. and re-enable it.
  104.  
  105. 23. cron mail doesn't go through aliasing
  106.   Hugh Stearns <hoyt@isus.tnet.com> reports that in 4.0.3.6 cron mail to adm
  107. doesn't get redirected by the aliases file.
  108.  
  109. 24. fragility in xterm
  110.   Hugh Stearns <hoyt@isus.tnet.com> reports that in 4.0.3.6, doing ~! from
  111. a cu in xterm kills xterm.  This has been fixed in Dell 2.2.
  112.  
  113. 25. csh lossage due to bad optimization
  114.   If a csh user sources a non-existent file in their .cshrc (eg, source .alias,
  115. where .alias doesn't exist), then the system will hang for a couple of minutes.
  116. Eventually the user get an "Out of memory" error and the console logs "NOTICE:
  117. out of swap space - Insufficient memory to allocate 2 pages - system call
  118. failed".
  119.   This appears to be due to over-optimization of code surrounding a longjmp
  120. call.
  121.   (There are numerous other reports of memory leak bugs in csh).
  122.  
  123. 26. Bug in cp(1)
  124.    If ``copy'' encounters a directory before a file, it dumps core ...
  125.  
  126. --- cut ---
  127. cd /tmp
  128. mkdir copybug jnk
  129. cd jnk
  130. mkdir directory
  131. >file
  132. cp -r * /tmp/copbug
  133. --- cut ---
  134.  
  135. This was reported from Consensys 4.0.3 but is probably a generic SVr4 bug.
  136.  
  137. 27. tbl -me doesn't work
  138.    Wolfgang Denk reports that trying to use "tbl -me" for any input file causes
  139. tbl to quit.  The problem is that newer tbl versions don't accept [nt]roff
  140. contol lines (".rm @W") after .TS.
  141.  
  142. 28. who -r fragility leads to boot-time problems
  143.   It coredumps if the name of the timezone is longer than three characters.
  144. This can be a real problem for European sites...  and is potentially more
  145. hazardous than immediately apparent as _a lot_ of the initialization scripts
  146. (rc1.d, rc2.d) use ``who -r'' to see if the machine is in single- or multi-user
  147. mode.  And when ``who'' bombs out, the ``set'' command is iven an empty
  148. command-line and can't do much else than print the shell variables, $1-$9
  149. remain empty ... meaning that more or less all the scripts fail in various ways
  150. and the system has an exceptionally hard time coming up.
  151.  
  152. 29. at(1) breaks here-documents in shell scripts
  153.    at adds gratuitous empty lines to the job submitted by the user.
  154. This prevents shell here-documents from working.
  155.  
  156. III. Networking and File Sharing Bugs
  157.  
  158. 1. NFS locking is unusably slow
  159.    Randy Terbush <randy@dsndata.dsndata.com> has posted code which
  160. demonstrates a serious bug in the SVr4 NFS locking daemon.
  161.    In his own words: "The symptoms are ~30% cpu usage by 'lockd' and
  162. severe slowing of the machines on the network.  This program
  163. demonstates that it takes ~20 seconds to obtain locks from an ailing
  164. 'lockd'.  We have verified that this bug does not exist in HPUX 8.0x."
  165.    Randy's code is too large to be included here.  He is, quite
  166. rightly, exercised at USL's exceedingly slow response to this problem.
  167. The comment in his makefile reads, in part:
  168.  
  169. # USL has admitted to the existance of this bug in version 4.0, 4.1,
  170. # and 4.2 of their distributed and yet to be released sources.  This is
  171. # a network crippling problem that they have refused to fix until
  172. # release 4.3, which will be OVER 1 YEAR from today. (29 Oct 1992)
  173. # If your version of 'lockd' exhibits this same problem, I would
  174. # strongly urge you to contact your vendor and ask them to put some
  175. # pressure on USL to fix this problem.  SVR4 is virtually useless in a
  176. # network of shared resources while this problem exists.
  177.  
  178. 2. UFS file system problems
  179.    In stock USL 4.0.3, you can't use a UFS file system as the root; the system
  180. hangs if you try.  Consensys, Dell, Esix, Microport, MST, UHC, and ESIX all
  181. appear to have fixed this.
  182.    David Aitken, the UNIX product manager at UHC, writes "The ufs as root file
  183. system [problem] was not really a bug, just a little oversight on USL's part -
  184. we have fixed it completely by adding one line to the /stand/boot script:
  185. rootfstype=ufs!"  He adds that they've been using ufs on their lab machines for
  186. over 10 months with no trouble, and the latest UHC release defaults to ufs if
  187. you have more than 120MB of disk.
  188.  
  189. 3. Byte-order problem with NFS when accessing Sun disks
  190.    Christoph Badura <bad@generics.ka.sub.org> notes that the stock USL resolver
  191. library suffers from serious confusion about the byte order in the
  192. socketaddr_in structure.  This bug is acknowledged by USL for the 4.0.4
  193. release.  A symptom of this bug is that Sun disks will not mount correctly over
  194. NFS. As a workaround, try removing the references to /usr/lib/resolv.so from
  195. /etc/netconfig and rebooting your system.  Unfortunately, this will mean
  196. you can't use nameservers.
  197.    Alan Batie <batie@agora.rain.com> writes: "Actually, you don't have to
  198. remove resolv.so, just put tcpip.so first and have a hosts file with the names
  199. of hosts you want to do NFS mounts from.  This way you can use nameservers for
  200. most things."
  201.  
  202. 4. Under weird circumstances, lseek on UFS may cause corruption
  203.   Christoph Badura <bad@generics.ka.sub.org> reports that a UFS lseek() to an
  204. offset which is a multiple of 4096 but not a multiple of 8192, followed by a
  205. write(), may corrupt the file being written.  The bug shows up only, if the
  206. file has no pages in the page pool associated with it at the seek offset and at
  207. 4k before the seek offset.  He has sent USL kernel fix for this, which was
  208. included in 4.0.4.
  209.  
  210. 5. FTP problems
  211.   The in.ftpd on SVR4.0.3 does not support all the commands listed in RFC 959.
  212. When recent SCO UNIX/ODT versions ftp to SVR4.0.3, the SVR4 side will refuse,
  213. drop the connection, and core dump after you authenticate.  This is because the
  214. SCO end sends the 'SYST' command ala RFC 959, and the SVR4.0.3 end doesn't
  215. recognise it.  Some ports have fixed this.
  216.   Christoph Badura adds: "The bug is do to a longjmp(3) on a sigjmpbuf obtained
  217. by sigsetjmp(3). ARGH. Testing led to a bug in the original BSD sources, which
  218. is still present in the NET/2 ftpd.  "
  219.  
  220. 6. A bug in the WD80x3 support
  221.    MST reports a serious bug in the SVr4 kernel support for this card.  Here's
  222. how to reproduce it:
  223.  
  224.     server: init 3 and share (export) /usr for example.
  225.  
  226.     client: mount -F nfs server:/usr /mnt
  227.         cd /mnt
  228.         find . -print | cpio -ocBuv > /dev/null
  229.  
  230.     what happens:
  231.         server and client will "hang" together.
  232.  
  233.     "cue":
  234.         hit keys on server and/or client, hang will go away
  235.         for 10-20 seconds temporarily.  Yank BNC connectors
  236.         do the same trick.
  237.  
  238.    They say they've heard from customers that this happens on Dell, UHC as well
  239. as USL 4.0.4.  PCNFS/BWNFS network xcopy suffers this as well.  Client can be a
  240. Sun Sparc for that matter.
  241.  
  242. IV. SCSI Support Problems
  243.  
  244. 1. sar is confused by SCSI
  245.    Sar -d doesn't work on SCSI drives.  Dell fixed this in 2.1 and it's
  246. reported to work OK in Esix 4.0.3A; no report of any other SVr4 having fixed
  247. this yet.  SCO fixed it in 3.2.4.
  248.  
  249. 2. A configuration problem
  250.    Stock USL requires you to jumper your SCSI devices to fixed IDs
  251. during installation (it can be changed to any other ID after).
  252.    Dell says they've fixed this.  The requirement is definitely still present
  253. in Esix and Consensys 1.3.  UHC thinks they've fixed this, but their 4.0.3.6
  254. release still seems to demand ID 1 to install.
  255.  
  256. 3. Synchronous SCSI hang problem
  257.    David Wexelblat <dwex@mtgzfs3.att.com> reports: "Stock SVR4.0.3 will hang
  258. the SCSI bus with a 1542 in synchronous mode.  Dell fixed this, and this has
  259. been given to Microport [ed note: Microport 4.0.4 and Consensys 4.0.3 have
  260. fixed the problem; MST UNIX and Esix 4.0.3 still have this problem; I have not
  261. yet been able to determine if ESIX 4.0.4 does].  In the file /sbin/bcheckrc,
  262. change the line:
  263.  
  264.     echo MARK > /dev/rswap
  265.  
  266. to
  267.         
  268.     echo MARK | dd of=/dev/rswap bs=512 conv=sync > /dev/null 2>&1
  269.  
  270. The magic is apparently the conv=sync, which forces a 512 byte block
  271. to be written.  The original echo writes 4 bytes, which apparently causes
  272. synchronous SCSI to go out to lunch.
  273.  
  274. Now, you ask, how can I fix this, since the system won't boot?  There are
  275. a couple of methods.  First, if possible, disable synchronous negotiation
  276. (1542 jumper J5-1 removed, plus whatever you may need to do to your drive).
  277. Then boot up, edit /sbin/bcheckrc, then shutdown, restrap for synchronous,
  278. then reboot.  Everything should be OK.
  279.  
  280. That's the easy way.  Unfortunately, some hard drives will only work
  281. in synchronous mode.  Well, you can still recover from this phenomenon.
  282. Here's how:
  283.  
  284.         1) Install on your hard drive
  285.         2) Boot from the first boot floppy.  When it tells you to, insert
  286.            the second boot floppy.  At the first prompt, hit <DEL> to
  287.            break out to a shell.
  288.         3) Mount your hard drive under /mnt with the following command
  289.            (replace FS-TYPE with s5, s52, or ufs, whichever you used for
  290.            for your root partition):
  291.  
  292.                 /etc/fs/FS-TYPE/mount /dev/dsk/c0t0d0s1 /mnt
  293.  
  294.         4) Now edit /mnt/sbin/bcheckrc:
  295.  
  296.                 ed /mnt/sbin/bcheckrc
  297.  
  298.            You may want the 'ed' man page handy (I barely remember how to
  299.            to use 'ed' :->).  For simplicity, you can delete/comment out
  300.            the offending line, then replace it with the correct line later.
  301.         5) Unmount the hard drive:
  302.  
  303.                 umount /mnt
  304.  
  305.         6) Reboot from the hard drive.  Everything should come up OK. and
  306.            you can finish editing /sbin/bcheckrc, if necessary.
  307.  
  308. Note that you perform these actions at your own risk.  The first version was
  309. performed by me on Microport SVR4, and the second was performed by someone
  310. else (on my suggestion) on ESIX SVR4."
  311.    This problem appears to be fixed on Consensys 1.3 and Dell 2.1.
  312.  
  313. 4. ps chokes on commands that do SCSI I/O
  314.   Hugh Stearns <hoyt@isus.tnet.com> reports that in 4.0.3.6, ps
  315. doesn't work when a SCSI command in progress. It stops printing at the
  316. process executing the scsi command.
  317.   This is still broken in Dell 2.2.
  318.  
  319. 5. Transfer speed problems with Adaptec 1542B on 486s
  320.   If a system mount or install fails, try setting the DMA speed to 5MB/s,
  321. rather than the default 5.7MB/s.  This is accomplished by removing the jumper
  322. shorting the 12th pin pair of jumper block 5.
  323.  
  324. V. Development Tools Problems
  325.  
  326. 1. General UCB library brokenness
  327.    The BSD compatibility libraries were badly broken in USL code.  A Dell
  328. source adds "That meant that almost all the apps derived from them were broken
  329. too.  Most stuff like automount will die when you send a SIGHUP, instead of
  330. rereading the map file.  You can get a system into very strange states when
  331. that happens."
  332.    John Sully <jms@mport> of Microport opines: "This is a bug in automount
  333. itself rather than BSD compatibility, since the automount which comes with SVR4
  334. is not compiled with the BSD libraries.  (isn't this comforting??  :-()."
  335.  
  336.    Esix and UHC's BSD libraries are USL stock.  I don't yet know
  337. the status of other ports.  Microport has run into things they think may be
  338. symptoms of this but have no fix yet.
  339.  
  340.    John Sully <jms@mport> of Microport counters with: "One common thread I find
  341. on reading of these problems is that the BSD compatibility libraries are
  342. *misused*. [...] The problem is that BSD and SYSV have similarly named .h files
  343. which sometimes contain different definitions for objects with the same name.
  344. This has been known to cause all sorts of problems because the SYSV headers are
  345. picked up and then the calls are satisfied from the BSD library rather than the
  346. shared object library.  I have found that if you use /usr/ucb/cc that the BSD
  347. compatibility is much less broken than it would seem at first because it
  348. ensures that the correct headers are picked up."
  349.  
  350.    However, note that there is at least one *real* bug known --- as of 4.0.4
  351. the signal emulation cannot explicitly set a handler to SIG_DFL or SIG_IGN.
  352.  
  353.    Ron Guilmette <rfg@ncd.com> writes "[Library lossage] may be easily
  354. demonstrated by attempting to build and link the GNU C compiler with
  355. `-L/usr/ucblib -lucb'.  The resulting compiler will most certainly
  356. crash and die."  John Sully thinks this is because the /usr/ucb/cc
  357. compiler should have been used, but wasn't.
  358.  
  359. 2. USL emulation of BSD signals doesn't work
  360.    A different source reports that the the USL implementatation of BSD signals
  361. is broken in both 4.0.3 and 4.0.4; in particular, the sigvec() family doesn't
  362. work properly.  It is possible to make minor tweaks to source to make such apps
  363. work properly with the native USL signals implementation.
  364.  
  365.    Here's more on the signals problem, thanks to Richard <rc@siesoft.co.uk>:
  366. ------------------------------------------------------------------------------
  367. The problem is to do with the signal() function that is within the BSD
  368. compatability libc.
  369.  
  370. To reproduce the problem do the following:
  371.  
  372. #include <stdio.h>
  373. #include <sys/types.h>
  374. #include <signal.h>
  375. #include <sys/siginfo.h>
  376.  
  377. main()
  378. {
  379.     signal(SIGPIPE,SIG_IGN);
  380.     pause();
  381. }
  382.  
  383. and compile it with cc xx.c -o xx /usr/ucblib/libucb.a
  384.  
  385. (John Sully observes that this is definitely wrong; /usr/ucb/cc should have
  386. been used rather than "cc ... -L/usr/ucblib -lucb" or the equivalent "cc ...
  387. /usr/ucblib/libucb.a".)
  388.  
  389. If you run the program and then signal it with a SIGPIPE, the program
  390. will die, even though you've told it to ignore SIGPIPE.
  391.  
  392. The fix is difficult unless you've got source because there's a missing 'else'
  393. clause from the signal() code. This is the only signal fault I've found in
  394. the BSD signal functions, details of the rumoured sigvec problem would be
  395. useful?
  396.  
  397. If you're trying to compile an application you could change the application
  398. code to do the following, this does work..
  399.  
  400. void
  401. catch(s)
  402. int    s;
  403. {
  404.     /* DO NOTHING */
  405.     ;
  406. }
  407.  
  408. main()
  409. {
  410.     signal(SIGPIPE,catch);
  411.     pause();
  412. }
  413.  
  414. SUMMARY
  415. You can only change a signal handler to a function handler, any number of
  416. times.  Any attempt to set the handler to SIG_DFL, or SIG_IGN will fail.
  417.  
  418. This bug has given some people working with X11R5 aggro, causing the X server
  419. to die when you close a client.
  420.  
  421.   Christoph Badura <bad@flatlin.ka.sub.org> confirms this bug
  422. He has sent USL a source fix.  It appears already to have been fixed in Dell
  423. 2.2.
  424. ------------------------------------------------------------------------------
  425.  
  426. 3. Possible string library problems
  427.    There are also persistent rumors of problems in the BSD-emulation string
  428. libraries.  I have not been able to pin down specifics on this.
  429.  
  430. 4. USL's ndbm support is broken.
  431.    Christoph Badura <bad@generics.ka.sub.org> reports "The ndbm functions in
  432. the ucb library are broken [apparently due to a compiler of optimizer bug in cc
  433. -- ed.].  Try makeing the whatis data base for /usr/share/man with Tom
  434. Christiansen's perl rewrite of man.
  435.    The easiest way to fix this is to compile GNU's replacement ndbm.c with gcc
  436. -fpcc-struct-return -traditional (gcc1.40 or 2.2 will do nicely) and install it
  437. in your C library.  Source is available for FTP from prep.ai.mit.edu.
  438.  
  439. 5. An include file is missing
  440.    Both 4.0.3 and 4.0.4 USL versions are missing the documented dial.h
  441. file from their /usr/include directory.  Dell 2.1 has it.
  442.  
  443. 6. sscanf(3) has a potential bug
  444.    Anthony Shipman <als@bohra.cpg.oz.au> reports: " I found the following bug
  445. in SCO Unix 3.2.* and I think it may be common to many AT&T derived Unixes.
  446.  
  447. sscanf() calls _doscan() to read from a pretend file.  The file
  448. uses the string as a buffer and a fake file descriptor of 60 (=_NFILE).
  449. Since _NFILE (for SCO UNIX) is 60 it assumes that fd 60 can never be open.
  450.  
  451. Then when fscanf() hits the end of the string it calls _filbuf() to read
  452. into the buffer (which is the string) from fd 60.  This should fail with
  453. an errno=9 and then _filbuf() sets EOF and it all terminates.
  454.  
  455. However in SCO Unix you can reconfigure the kernel to increase the number
  456. of files per process to a recommended maximum of 150.  If you do this then
  457. your program might have fd 60 open one day.  Then sscanf() will read from this
  458. file overwriting your string.  The byte count to the read() in _filbuf()
  459. is some undefined but large value so a lot of memory will be overwritten.  In
  460. my case the string was on the stack so my stack was wiped.
  461.  
  462. In short if you configure your kernel to have NOFILES > _NFILE ie more than
  463. the default then sscanf() is a time bomb in your code."
  464.  
  465. 7. Compiler problems
  466.    Ronald Guilmette <rfg@ncd.com> also reports the following:
  467.  
  468. ------------------------------------------------------------------------------
  469. /* Here is a bug in the original SVR4 C compiler (aka C Issue 5) which
  470.    effectively prevents you from making good use of the `const' and
  471.    `volatile' qualifiers defined by ANSI C in conjunction with pointer
  472.    types and typedef statements.  Compile this code and you will get:
  473.  
  474.    "qualifiers.c", line 23: left operand must be modifiable lvalue: op "="
  475.  
  476.    ...if your copy of the svr4 C compiler still has the bug.  Note that
  477.    given these declarations, the ANSI C standard say that the thing pointed
  478.    to by the variable `pci' should be considered to be constant... not the
  479.    variable `pci' itself.  (The GCC compiler, either version 1.x or version
  480.    2.x, correctly compiles this example without complaint.)
  481. */
  482.  
  483. typedef const int *ptr_to_const_int;
  484.  
  485. ptr_to_const_int pci;
  486.  
  487. int i;
  488.  
  489. void main ()
  490. {
  491.   pci = &i;
  492. }
  493. ------------------------------------------------------------------------------
  494. /* Here is a subtle bug in the original SVR4 C compiler (aka C Issue 5)
  495.    which prevents you from first declaring a tagged type (i.e. a struct
  496.    type or a union type) in a parameter list, and then defining that tagged
  497.    type later on within the same scope.  (Note that according to the ANSI C
  498.    standard, the scope in which parameters get declared and the outermost
  499.    block of a function body are one and the same scope.  Thus, this really
  500.    is legal ANSI C code!)
  501.  
  502.    Try compiling this with your C compiler on SVR4.  If your compiler still
  503.    has the bug, you will get:
  504.  
  505.    "tagged_type.c", line 24: warning: dubious tag declaration: struct S
  506.    "tagged_type.c", line 28: warning: improper member use: i
  507.    "tagged_type.c", line 28: warning: improper member use: i
  508.    "tagged_type.c", line 31: warning: dubious tag declaration: struct S
  509.    "tagged_type.c", line 35: warning: improper member use: i
  510.    "tagged_type.c", line 35: warning: improper member use: i
  511.  
  512.    (The GCC compiler also had this bug in version 1.x, but it has been fixed
  513.    in version 2.x.)
  514. */
  515.  
  516. void foobar1 (arg)        /* use old-style without prototypes */
  517.     struct S *arg;
  518. {
  519.   struct S { int i; };        /* define the type `struct S' */
  520.  
  521.   arg->i = arg->i;        /* legal according to ANSI C rules! */
  522. }
  523.  
  524. void foobar2 (struct S *arg)    /* use new-style with prototypes */
  525. {
  526.   struct S { int i; };        /* define the type `struct S' */
  527.  
  528.   arg->i = arg->i;        /* legal according to ANSI C rules! */
  529. }
  530. ------------------------------------------------------------------------------
  531. /* Here is a serious bug in the original SVR4 `dump' program which dumps
  532.    out parts of object files in either plain hex form or symbolically.
  533.  
  534.    To see the `dump' program get a segfault and die, save this code under
  535.    the name `dump-bug.c' and then do:
  536.  
  537.     cc -g -c dump-bug.c
  538.     dump -v -D dump-bug.o
  539.  
  540.    The bug arises whenever `dump' tries to read Dwarf debugging information
  541.    for an array of pointers to any "user defined" type (e.g. `struct S' in
  542.    this example).  Past that point, `dump' is totally confused, so further
  543.    Dwarf debugging information finally causes it to go belly-up.
  544. */
  545.  
  546. struct S { int i; };
  547. struct S *array[10];
  548. int j;
  549. ------------------------------------------------------------------------------
  550. It appears that the svr4 C compiler (for x86 machines) doesn't conform real
  551. well to either the letter or the spirit of the IEEE 754 floating-point
  552. standard.  In particular, "unordered comparisons" and other operations on
  553. NaNs don't always produce the result that that the IEEE 754 standard calls
  554. for.
  555.  
  556. An AT&T source comments: "This is documented in the SVID as a future direction.
  557. We do not support NaNs in -Xa and -Xt modes, only in -Xc.  Try
  558. isnan(sqrt(-1.0)) to determine which modes support it."
  559. ------------------------------------------------------------------------------
  560.  
  561. The compiler fails to issue diagnostics for cases where a floating point
  562. literal is given which exceeds the range of its type (either float or
  563. double).  Actually this one could be argued either way, since IEEE FP
  564. format includes "infinities" and the compiler probably just changes any
  565. FP value which is out of range for its type into either positive infinity
  566. or negative infinity (as appropriate).
  567.  
  568. The compiler fails to issue diagnostics in cases where a typedef name is
  569. reused to declare a formal parameter, as in:
  570.  
  571. -----------------------------------------------------------------------
  572. typedef int FOO;
  573. void bar (FOO)
  574.     int FOO;
  575. {
  576. }
  577. -----------------------------------------------------------------------
  578.  
  579. The compiler crashes on the following invalid input:
  580.  
  581. -----------------------------------------------------------------------
  582. int i;
  583. volatile void *pvv;
  584.  
  585. void pvv_test ()
  586. {
  587.   (i ? *pvv : *pvv);    /* ERROR */
  588. }
  589. -----------------------------------------------------------------------
  590.  
  591. The compiler fails to issue diagnostics for cases where an attempt is
  592. made to "forward declare" an enum type (without also defining it), as
  593. in:
  594.  
  595. -----------------------------------------------------------------------
  596. enum enum0 *ep;       /* ERROR */
  597. -----------------------------------------------------------------------
  598.  
  599. The compiler rejects the following code with an error, although there
  600. seems to be no good reason why it should (because no object is being
  601. declared).
  602.  
  603. -----------------------------------------------------------------------
  604. #include <limits.h>
  605.  
  606. typedef char array_type[ULONG_MAX];
  607. -----------------------------------------------------------------------
  608.  
  609. VI. The FUBYTE Problem
  610.  
  611. (Thanks to Christoph Badura <bad@flatlin.ka.sub.org> for this info)
  612.  
  613. The kernel function fubyte() is documented to return a positive value when
  614. given a valid user space address and -1 otherwise. In the latter case u.u_error
  615. is set to EFAULT.  USL SysV R4.0.3 has a sign extension bug in the
  616. implementation of fubyte() for local file descriptors (i.e. not opened via
  617. RFS), which causes fubyte() to return negative values if the byte fetched has
  618. its high bit set. This bug doesn't affect STREAMS drivers, as they don't call
  619. (and in fact are normally unable to call) fubyte().  Thus writing a byte with
  620. the high bit set to certain character device drivers returns with -1 and errno
  621. set to EFAULT.
  622.  
  623. The bug may affect any character device driver that calls fubyte(). It's not
  624. limited to serial card drivers. The bug is noticed most often with serial card
  625. drivers, since uucp uses byte values > 127 very early during g-protocol setup
  626. and drivers for serial cards tend to use fubyte() quite often.
  627.  
  628. Note also that the bug's effect is different if the driver checks for a -1
  629. return value of fubyte() or just a negative one. In the former case it is
  630. possible to pass bytes with the 8 bit set through fubyte(), except for 0xff
  631. which is -1 in two's complement. That makes the bug more obscure.
  632.  
  633. The fix is easy.  First, make a backup copy of the kernel object file
  634. /etc/conf/pack.d/kernel/vm.o!  A disassembly of vm.o(lfubyte) should reveal
  635. *exactly* one mov[s]bl (move byte to long w/sign extend).  That one needs to be
  636. patched into a movzbl (zero extend). The difference is one bit in the second
  637. byte of the opcode.
  638.  
  639. The movsbl has the bit pattern 00001111 1011111w mod/rm-byte.
  640. The movzbl has the bit pattern 00001111 1011011w mod/rm-byte.
  641.  
  642. The 'w' bit is 0 for the instruction in question. So the opcodes are 0f be and
  643. 0f b6. Here is the diff -c from dis -F lfubyte showing the patch applied to
  644. the Dell 2.1 kernel:
  645.  
  646. *** vm.o    Mon Mar  9 00:31:38 1992
  647. --- vm.o.org    Mon Mar  9 00:32:40 1992
  648. ***************
  649. *** 22,28 ****
  650.       11c90:  85 c0                 testl  %eax,%eax
  651.       11c92:  75 09                 jne    0x9 <11c9d>
  652.       11c94:  8b 45 08              movl   8(%ebp),%eax
  653. !     11c97:  0f b6 00              movzbl (%eax),%eax
  654.       11c9a:  89 45 fc              movl   %eax,-4(%ebp)
  655.       11c9d:  c7 05 d8 13 00 00 00 00 00 00 movl   $0x0,0x13d8
  656.       11ca7:  83 3d dc 13 00 00 00  cmpl   $0x0,0x13dc
  657. --- 22,28 ----
  658.       11c90:  85 c0                 testl  %eax,%eax
  659.       11c92:  75 09                 jne    0x9 <11c9d>
  660.       11c94:  8b 45 08              movl   8(%ebp),%eax
  661. !     11c97:  0f be 00              movsbl (%eax),%eax
  662.       11c9a:  89 45 fc              movl   %eax,-4(%ebp)
  663.       11c9d:  c7 05 d8 13 00 00 00 00 00 00 movl   $0x0,0x13d8
  664.       11ca7:  83 3d dc 13 00 00 00  cmpl   $0x0,0x13dc
  665.  
  666. Of course there is a workaround at the driver level.  Canonically, one would do
  667. this by checking for fubyte() returning -1 *and* u.u_error being set to EFAULT
  668. (u.u_error is cleared upon entering a system call).  However, in R4.0.3
  669. fubyte() does NOT set u.u_error.  It *does* set u.u_fault_catch.fc_errno.
  670.